
        package com.happyscan138.makefun.adapter;


        import android.content.Context;
        import android.view.View;
        import android.view.ViewGroup;
        import android.widget.BaseAdapter;
        import android.widget.FrameLayout;
        import android.widget.ImageView;
        import android.widget.TextView;

        import com.happyscan138.makefun.BaseAdapter.persional_VIDEO;
        import com.happyscan138.makefun.R;
        import com.happyscan138.makefun.View.RoundImageView;
        import com.happyscan138.makefun.base.VideoPlayView;
        import com.squareup.picasso.Picasso;

        import java.util.List;

        /**
         * Created by Administrator on 2017/1/1.
         */

        public class Persional_VideoAdapter extends BaseAdapter implements VideoPlayView.MediaPlayerImpl {
            public Persional_VideoAdapter(Context mContext, List<persional_VIDEO> data) {
                this.mContext = mContext;
                this.data = data;
            }
            private boolean isPlaying=false;
            private Context mContext;
            private List<persional_VIDEO> data;

            @Override
            public int getCount() {
                return data.size();
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public View getView(int position, View view, ViewGroup parent) {
                final ViewHolder_Persional_VIDEO viewHolder;
                if(view==null){
                    //dsdsds
                    viewHolder=new ViewHolder_Persional_VIDEO();
                    view=View.inflate(mContext, R.layout.persional_video_item,null);
                    viewHolder.Persional_head=(RoundImageView) view.findViewById(R.id.persional_video_head);
                    viewHolder.Persional_name=(TextView) view.findViewById(R.id.persional_video_name);
                    viewHolder.Persional_time=(TextView) view.findViewById(R.id.persional_video_time);
                    viewHolder.Persional_comment=(TextView) view.findViewById(R.id.persional_video_comment);
                    viewHolder.Persional_playView=(VideoPlayView)view.findViewById(R.id.persional_video_play_view);
                    viewHolder.Persional_showLayout=(FrameLayout)view.findViewById(R.id.saoku_show_layout);
                    viewHolder.Persional_play=(ImageView) view.findViewById(R.id.persional_video_play_btn);
                    viewHolder.Persional_nicheng=(TextView) view.findViewById(R.id.persional_video_nicheng);
                    viewHolder.Persional_text=(TextView) view.findViewById(R.id.persional_video_text);

                    //将viewHolder与converView绑定
                    view.setTag(viewHolder);
                }else {
                    //如果存在converView，取出保存在converView中的viewHolder
                    viewHolder=(ViewHolder_Persional_VIDEO) view.getTag();
                }
                final persional_VIDEO bean=data.get(position);
                Picasso.with(mContext).load(bean.head).into(viewHolder.Persional_head);
                viewHolder.Persional_name.setText(bean.nicheng);
                viewHolder.Persional_time.setText(bean.time);
                viewHolder.Persional_comment.setText(bean.comment);
                viewHolder.Persional_nicheng.setText(bean.name);
                viewHolder.Persional_play.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        isPlaying = true;
                        viewHolder.Persional_showLayout.setVisibility(View.GONE);
                        viewHolder.Persional_playView.setUrl(bean.resource);
                        setPlayView(viewHolder.Persional_playView);
                        viewHolder.Persional_playView.openVideo();
                        viewHolder.Persional_playView.setVisibility(View.VISIBLE);
                    }
                });

                viewHolder.Persional_text.setText(bean.content);
                return view;
            }
            public void setPlayView(VideoPlayView playView) {
                playView.setMediaPlayerListenr(this);
            }

            @Override
            public void onError() {

            }

            @Override
            public void onExpend() {

            }

            @Override
            public void onShrik() {

            }
        }
        class ViewHolder_Persional_VIDEO{
            public RoundImageView Persional_head;
            public TextView Persional_name;
            public TextView Persional_time;
            public TextView Persional_comment;
            public VideoPlayView Persional_playView;
            public FrameLayout Persional_showLayout;
            public ImageView Persional_play;
            public TextView Persional_nicheng;
            public TextView Persional_text;


        }
